#pragma once
#include <string>

using namespace std;

class article
{
private:
	string date;
	string title;
	string writer;
	string paper;
public:

	article() : date("N/A"), title("N/A"), writer("N/A"), paper("N/A")
	{
	}

	article(string date, string title, string writer, string paper)
	{
		this->date = date;
		this->title = title;
		this->writer = writer;
		this->paper = paper;
	}

	~article()
	{
	}

	void read()
	{
		cout << "date: ";
		getline(cin, date);
		cout << "title: ";
		getline(cin, title);
		cout << "writer: ";
		getline(cin, writer);
		cout << "paper: ";
		getline(cin, paper);
	}

	friend ostream& operator<<(ostream &out, const article &a)
	{
		out << "(" << a.date << "," << a.title << "," << a.writer << "," << a.paper << ")";
		return out;
	}

	friend istream& operator>>(istream &in, article &a)
	{
		string str;
		getline(in, str, '(');
		getline(in, a.date, ',');
		getline(in, a.title, ',');
		getline(in, a.writer, ',');
		getline(in, a.paper, ')');
		return in;
	}

	string get_date(){ return date; }
};

